{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1、导入必要的工具包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 552,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np  # 矩阵操作\n",
    "import pandas as pd # SQL数据处理\n",
    "\n",
    "from sklearn.metrics import r2_score  #评价回归预测模型的性能\n",
    "\n",
    "import matplotlib.pyplot as plt   #画图\n",
    "import seaborn as sns\n",
    "\n",
    "# 图形出现在Notebook里而不是新窗口\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2、数据探索"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.1 读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 553,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>dteday</th>\n",
       "      <th>season</th>\n",
       "      <th>yr</th>\n",
       "      <th>mnth</th>\n",
       "      <th>holiday</th>\n",
       "      <th>weekday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>weathersit</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>casual</th>\n",
       "      <th>registered</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2011-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.344167</td>\n",
       "      <td>0.363625</td>\n",
       "      <td>0.805833</td>\n",
       "      <td>0.160446</td>\n",
       "      <td>331</td>\n",
       "      <td>654</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2011-01-02</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.363478</td>\n",
       "      <td>0.353739</td>\n",
       "      <td>0.696087</td>\n",
       "      <td>0.248539</td>\n",
       "      <td>131</td>\n",
       "      <td>670</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>2011-01-03</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.196364</td>\n",
       "      <td>0.189405</td>\n",
       "      <td>0.437273</td>\n",
       "      <td>0.248309</td>\n",
       "      <td>120</td>\n",
       "      <td>1229</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>2011-01-04</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.200000</td>\n",
       "      <td>0.212122</td>\n",
       "      <td>0.590435</td>\n",
       "      <td>0.160296</td>\n",
       "      <td>108</td>\n",
       "      <td>1454</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>2011-01-05</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.226957</td>\n",
       "      <td>0.229270</td>\n",
       "      <td>0.436957</td>\n",
       "      <td>0.186900</td>\n",
       "      <td>82</td>\n",
       "      <td>1518</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant      dteday  season  yr  mnth  holiday  weekday  workingday  \\\n",
       "0        1  2011-01-01       1   0     1        0        6           0   \n",
       "1        2  2011-01-02       1   0     1        0        0           0   \n",
       "2        3  2011-01-03       1   0     1        0        1           1   \n",
       "3        4  2011-01-04       1   0     1        0        2           1   \n",
       "4        5  2011-01-05       1   0     1        0        3           1   \n",
       "\n",
       "   weathersit      temp     atemp       hum  windspeed  casual  registered  \\\n",
       "0           2  0.344167  0.363625  0.805833   0.160446     331         654   \n",
       "1           2  0.363478  0.353739  0.696087   0.248539     131         670   \n",
       "2           1  0.196364  0.189405  0.437273   0.248309     120        1229   \n",
       "3           1  0.200000  0.212122  0.590435   0.160296     108        1454   \n",
       "4           1  0.226957  0.229270  0.436957   0.186900      82        1518   \n",
       "\n",
       "    cnt  \n",
       "0   985  \n",
       "1   801  \n",
       "2  1349  \n",
       "3  1562  \n",
       "4  1600  "
      ]
     },
     "execution_count": 553,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv(\"day.csv\")\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 554,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 731 entries, 0 to 730\n",
      "Data columns (total 16 columns):\n",
      "instant       731 non-null int64\n",
      "dteday        731 non-null object\n",
      "season        731 non-null int64\n",
      "yr            731 non-null int64\n",
      "mnth          731 non-null int64\n",
      "holiday       731 non-null int64\n",
      "weekday       731 non-null int64\n",
      "workingday    731 non-null int64\n",
      "weathersit    731 non-null int64\n",
      "temp          731 non-null float64\n",
      "atemp         731 non-null float64\n",
      "hum           731 non-null float64\n",
      "windspeed     731 non-null float64\n",
      "casual        731 non-null int64\n",
      "registered    731 non-null int64\n",
      "cnt           731 non-null int64\n",
      "dtypes: float64(4), int64(11), object(1)\n",
      "memory usage: 91.4+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  2.2 数据基本信息\n",
    "样本数目、特征维数\n",
    "每个特征的类型、空值样本的数目、数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 555,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(731, 16)"
      ]
     },
     "execution_count": 555,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3 数据探索\n",
    "请见另一个文件：0_EDA_bike_sharing.pynb\n",
    "\n",
    "对数据的探索有助于我们在第三步中根据数据的特点选择合适的模型类型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.4 数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 556,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 把数据集分割为训练集和测试集\n",
    "data_train = data[data.yr == 0]\n",
    "data_test = data[data.yr == 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 557,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 从训练集中分离输入特征x和输出y\n",
    "X_train1 = data_train.drop('cnt',axis = 1)\n",
    "X_train2 = X_train1.drop('casual',axis = 1)\n",
    "# 去掉没用的日期列\n",
    "X_train3 = X_train2.drop('dteday',axis = 1)\n",
    "# 去掉没用的年份列\n",
    "X_train4 = X_train3.drop('yr',axis = 1)\n",
    "X_train = X_train4.drop('registered', axis = 1)\n",
    "y_train = data_train['cnt'].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 558,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 从测试集中分离输入特征x和输出y\n",
    "X_test1 = data_test.drop('cnt',axis = 1)\n",
    "X_test2 = X_test1.drop('casual',axis = 1)\n",
    "# 去掉没用的日期列\n",
    "X_test3 = X_test2.drop('dteday',axis = 1)\n",
    "# 去掉没用的年份列\n",
    "X_test4 = X_test3.drop('yr',axis = 1)\n",
    "X_test = X_test4.drop('registered', axis = 1)\n",
    "y_test = data_test['cnt'].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 559,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 输出结果看一下\n",
    "#X_train"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 560,
   "metadata": {},
   "outputs": [],
   "source": [
    "#y_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 561,
   "metadata": {},
   "outputs": [],
   "source": [
    "#X_test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 562,
   "metadata": {},
   "outputs": [],
   "source": [
    "#y_test.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 测试结果显示数据集和xy划分正确"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.5 数据预处理／特征工程"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 563,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_2</th>\n",
       "      <th>weekday_3</th>\n",
       "      <th>weekday_4</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 30 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6      ...       weekday_2  weekday_3  weekday_4  weekday_5  \\\n",
       "0       0       0      ...               0          0          0          0   \n",
       "1       0       0      ...               0          0          0          0   \n",
       "2       0       0      ...               0          0          0          0   \n",
       "3       0       0      ...               1          0          0          0   \n",
       "4       0       0      ...               0          1          0          0   \n",
       "\n",
       "   weekday_6  workingday_0  workingday_1  weathersit_1  weathersit_2  \\\n",
       "0          1             1             0             0             1   \n",
       "1          0             1             0             0             1   \n",
       "2          0             0             1             1             0   \n",
       "3          0             0             1             1             0   \n",
       "4          0             0             1             1             0   \n",
       "\n",
       "   weathersit_3  \n",
       "0             0  \n",
       "1             0  \n",
       "2             0  \n",
       "3             0  \n",
       "4             0  \n",
       "\n",
       "[5 rows x 30 columns]"
      ]
     },
     "execution_count": 563,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对训练集类别型特征进行one-hot预处理\n",
    "categorical_features = ['season','mnth','holiday','weekday','workingday','weathersit']\n",
    "train_onehot=pd.get_dummies(X_train, columns=categorical_features)\n",
    "train_cat=train_onehot.drop(train_onehot.columns[0:5],axis = 1)\n",
    "train_cat.head()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 564,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.360789</td>\n",
       "      <td>0.373517</td>\n",
       "      <td>0.828620</td>\n",
       "      <td>0.284606</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.385232</td>\n",
       "      <td>0.360541</td>\n",
       "      <td>0.715771</td>\n",
       "      <td>0.466215</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.173705</td>\n",
       "      <td>0.144830</td>\n",
       "      <td>0.449638</td>\n",
       "      <td>0.465740</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.178308</td>\n",
       "      <td>0.174649</td>\n",
       "      <td>0.607131</td>\n",
       "      <td>0.284297</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.212429</td>\n",
       "      <td>0.197158</td>\n",
       "      <td>0.449313</td>\n",
       "      <td>0.339143</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       temp     atemp       hum  windspeed\n",
       "0  0.360789  0.373517  0.828620   0.284606\n",
       "1  0.385232  0.360541  0.715771   0.466215\n",
       "2  0.173705  0.144830  0.449638   0.465740\n",
       "3  0.178308  0.174649  0.607131   0.284297\n",
       "4  0.212429  0.197158  0.449313   0.339143"
      ]
     },
     "execution_count": 564,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对训练集数值型特征做预处理\n",
    "from sklearn.preprocessing import MinMaxScaler\n",
    "MMS = MinMaxScaler()\n",
    "numberical_features = ['temp', 'atemp', 'hum', 'windspeed']\n",
    "temp = MMS.fit_transform(X_train[numberical_features])\n",
    "X_train_num_MMS = pd.DataFrame(data = temp,columns= numberical_features)\n",
    "X_train_num_MMS.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 565,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    cnt\n",
       "0   985\n",
       "1   801\n",
       "2  1349\n",
       "3  1562\n",
       "4  1600"
      ]
     },
     "execution_count": 565,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 把训练集的y转化为DataFrame\n",
    "y_train_DF = pd.DataFrame(data = y_train,columns= ['cnt'])\n",
    "y_train_DF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 566,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.360789</td>\n",
       "      <td>0.373517</td>\n",
       "      <td>0.828620</td>\n",
       "      <td>0.284606</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.385232</td>\n",
       "      <td>0.360541</td>\n",
       "      <td>0.715771</td>\n",
       "      <td>0.466215</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.173705</td>\n",
       "      <td>0.144830</td>\n",
       "      <td>0.449638</td>\n",
       "      <td>0.465740</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.178308</td>\n",
       "      <td>0.174649</td>\n",
       "      <td>0.607131</td>\n",
       "      <td>0.284297</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.212429</td>\n",
       "      <td>0.197158</td>\n",
       "      <td>0.449313</td>\n",
       "      <td>0.339143</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6  ...   workingday_0  workingday_1  weathersit_1  \\\n",
       "0       0       0  ...              1             0             0   \n",
       "1       0       0  ...              1             0             0   \n",
       "2       0       0  ...              0             1             1   \n",
       "3       0       0  ...              0             1             1   \n",
       "4       0       0  ...              0             1             1   \n",
       "\n",
       "   weathersit_2  weathersit_3      temp     atemp       hum  windspeed   cnt  \n",
       "0             1             0  0.360789  0.373517  0.828620   0.284606   985  \n",
       "1             1             0  0.385232  0.360541  0.715771   0.466215   801  \n",
       "2             0             0  0.173705  0.144830  0.449638   0.465740  1349  \n",
       "3             0             0  0.178308  0.174649  0.607131   0.284297  1562  \n",
       "4             0             0  0.212429  0.197158  0.449313   0.339143  1600  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 566,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 合并类别与数值型特征数据，生成一个总的训练集\n",
    "BS_train = pd.concat([X_train_cat, X_train_num_MMS, y_train_DF], axis = 1)\n",
    "BS_train.to_csv('BS_train.csv', index= False)\n",
    "BS_train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 567,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_2</th>\n",
       "      <th>weekday_3</th>\n",
       "      <th>weekday_4</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>365</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>366</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>367</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>368</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>369</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 30 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "365         1         0         0         0       1       0       0       0   \n",
       "366         1         0         0         0       1       0       0       0   \n",
       "367         1         0         0         0       1       0       0       0   \n",
       "368         1         0         0         0       1       0       0       0   \n",
       "369         1         0         0         0       1       0       0       0   \n",
       "\n",
       "     mnth_5  mnth_6      ...       weekday_2  weekday_3  weekday_4  weekday_5  \\\n",
       "365       0       0      ...               0          0          0          0   \n",
       "366       0       0      ...               0          0          0          0   \n",
       "367       0       0      ...               1          0          0          0   \n",
       "368       0       0      ...               0          1          0          0   \n",
       "369       0       0      ...               0          0          1          0   \n",
       "\n",
       "     weekday_6  workingday_0  workingday_1  weathersit_1  weathersit_2  \\\n",
       "365          0             1             0             1             0   \n",
       "366          0             1             0             1             0   \n",
       "367          0             0             1             1             0   \n",
       "368          0             0             1             0             1   \n",
       "369          0             0             1             1             0   \n",
       "\n",
       "     weathersit_3  \n",
       "365             0  \n",
       "366             0  \n",
       "367             0  \n",
       "368             0  \n",
       "369             0  \n",
       "\n",
       "[5 rows x 30 columns]"
      ]
     },
     "execution_count": 567,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对测试集类别型特征进行one-hot预处理\n",
    "categorical_features = ['season','mnth','holiday','weekday','workingday','weathersit']\n",
    "test_onehot=pd.get_dummies(X_test, columns=categorical_features)\n",
    "X_test_cat=test_onehot.drop(test_onehot.columns[0:5],axis = 1)\n",
    "X_test_cat.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 574,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_2</th>\n",
       "      <th>weekday_3</th>\n",
       "      <th>weekday_4</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 30 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6      ...       weekday_2  weekday_3  weekday_4  weekday_5  \\\n",
       "0       0       0      ...               0          0          0          0   \n",
       "1       0       0      ...               0          0          0          0   \n",
       "2       0       0      ...               1          0          0          0   \n",
       "3       0       0      ...               0          1          0          0   \n",
       "4       0       0      ...               0          0          1          0   \n",
       "\n",
       "   weekday_6  workingday_0  workingday_1  weathersit_1  weathersit_2  \\\n",
       "0          0             1             0             1             0   \n",
       "1          0             1             0             1             0   \n",
       "2          0             0             1             1             0   \n",
       "3          0             0             1             0             1   \n",
       "4          0             0             1             1             0   \n",
       "\n",
       "   weathersit_3  \n",
       "0             0  \n",
       "1             0  \n",
       "2             0  \n",
       "3             0  \n",
       "4             0  \n",
       "\n",
       "[5 rows x 30 columns]"
      ]
     },
     "execution_count": 574,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 重置数据集索引\n",
    "X_test_cat=X_test_cat.reset_index(drop=True)\n",
    "X_test_cat.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 575,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.348066</td>\n",
       "      <td>0.389564</td>\n",
       "      <td>0.653416</td>\n",
       "      <td>0.368479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.219504</td>\n",
       "      <td>0.214212</td>\n",
       "      <td>0.189521</td>\n",
       "      <td>0.716652</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.056354</td>\n",
       "      <td>0.035004</td>\n",
       "      <td>0.278882</td>\n",
       "      <td>0.807826</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.025139</td>\n",
       "      <td>0.239130</td>\n",
       "      <td>0.349571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.209944</td>\n",
       "      <td>0.251337</td>\n",
       "      <td>0.402485</td>\n",
       "      <td>0.211026</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       temp     atemp       hum  windspeed\n",
       "0  0.348066  0.389564  0.653416   0.368479\n",
       "1  0.219504  0.214212  0.189521   0.716652\n",
       "2  0.056354  0.035004  0.278882   0.807826\n",
       "3  0.000000  0.025139  0.239130   0.349571\n",
       "4  0.209944  0.251337  0.402485   0.211026"
      ]
     },
     "execution_count": 575,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对测试集数值型特征做预处理\n",
    "from sklearn.preprocessing import MinMaxScaler\n",
    "MMS = MinMaxScaler()\n",
    "numberical_features = ['temp', 'atemp', 'hum', 'windspeed']\n",
    "temp = MMS.fit_transform(X_test[numberical_features])\n",
    "X_test_num_MMS = pd.DataFrame(data = temp,columns= numberical_features)\n",
    "X_test_num_MMS.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 576,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2236</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2368</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>3272</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    cnt\n",
       "0  2294\n",
       "1  1951\n",
       "2  2236\n",
       "3  2368\n",
       "4  3272"
      ]
     },
     "execution_count": 576,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 把测试集的y转化为DataFrame\n",
    "y_test_DF = pd.DataFrame(data = y_test,columns= ['cnt'])\n",
    "y_test_DF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 577,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.348066</td>\n",
       "      <td>0.389564</td>\n",
       "      <td>0.653416</td>\n",
       "      <td>0.368479</td>\n",
       "      <td>2294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.219504</td>\n",
       "      <td>0.214212</td>\n",
       "      <td>0.189521</td>\n",
       "      <td>0.716652</td>\n",
       "      <td>1951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.056354</td>\n",
       "      <td>0.035004</td>\n",
       "      <td>0.278882</td>\n",
       "      <td>0.807826</td>\n",
       "      <td>2236</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.025139</td>\n",
       "      <td>0.239130</td>\n",
       "      <td>0.349571</td>\n",
       "      <td>2368</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.209944</td>\n",
       "      <td>0.251337</td>\n",
       "      <td>0.402485</td>\n",
       "      <td>0.211026</td>\n",
       "      <td>3272</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6  ...   workingday_0  workingday_1  weathersit_1  \\\n",
       "0       0       0  ...              1             0             1   \n",
       "1       0       0  ...              1             0             1   \n",
       "2       0       0  ...              0             1             1   \n",
       "3       0       0  ...              0             1             0   \n",
       "4       0       0  ...              0             1             1   \n",
       "\n",
       "   weathersit_2  weathersit_3      temp     atemp       hum  windspeed   cnt  \n",
       "0             0             0  0.348066  0.389564  0.653416   0.368479  2294  \n",
       "1             0             0  0.219504  0.214212  0.189521   0.716652  1951  \n",
       "2             0             0  0.056354  0.035004  0.278882   0.807826  2236  \n",
       "3             1             0  0.000000  0.025139  0.239130   0.349571  2368  \n",
       "4             0             0  0.209944  0.251337  0.402485   0.211026  3272  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 577,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 合并类别与数值型特征数据，生成一个总的测试集\n",
    "BS_test = pd.concat([X_test_cat, X_test_num_MMS, y_test_DF], axis = 1)\n",
    "BS_test.to_csv('BS_test.csv', index= False)\n",
    "BS_test.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3、确定模型类型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.1 尝试缺省参数的线性回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 580,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.360789</td>\n",
       "      <td>0.373517</td>\n",
       "      <td>0.828620</td>\n",
       "      <td>0.284606</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.385232</td>\n",
       "      <td>0.360541</td>\n",
       "      <td>0.715771</td>\n",
       "      <td>0.466215</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.173705</td>\n",
       "      <td>0.144830</td>\n",
       "      <td>0.449638</td>\n",
       "      <td>0.465740</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.178308</td>\n",
       "      <td>0.174649</td>\n",
       "      <td>0.607131</td>\n",
       "      <td>0.284297</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.212429</td>\n",
       "      <td>0.197158</td>\n",
       "      <td>0.449313</td>\n",
       "      <td>0.339143</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6  ...   workingday_0  workingday_1  weathersit_1  \\\n",
       "0       0       0  ...              1             0             0   \n",
       "1       0       0  ...              1             0             0   \n",
       "2       0       0  ...              0             1             1   \n",
       "3       0       0  ...              0             1             1   \n",
       "4       0       0  ...              0             1             1   \n",
       "\n",
       "   weathersit_2  weathersit_3      temp     atemp       hum  windspeed   cnt  \n",
       "0             1             0  0.360789  0.373517  0.828620   0.284606   985  \n",
       "1             1             0  0.385232  0.360541  0.715771   0.466215   801  \n",
       "2             0             0  0.173705  0.144830  0.449638   0.465740  1349  \n",
       "3             0             0  0.178308  0.174649  0.607131   0.284297  1562  \n",
       "4             0             0  0.212429  0.197158  0.449313   0.339143  1600  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 580,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 读取训练集\n",
    "BS_train_data= pd.read_csv(\"BS_train.csv\")\n",
    "BS_train_data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 591,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index([u'season_1', u'season_2', u'season_3', u'season_4', u'mnth_1',\n",
       "       u'mnth_2', u'mnth_3', u'mnth_4', u'mnth_5', u'mnth_6', u'mnth_7',\n",
       "       u'mnth_8', u'mnth_9', u'mnth_10', u'mnth_11', u'mnth_12', u'holiday_0',\n",
       "       u'holiday_1', u'weekday_0', u'weekday_1', u'weekday_2', u'weekday_3',\n",
       "       u'weekday_4', u'weekday_5', u'weekday_6', u'workingday_0',\n",
       "       u'workingday_1', u'weathersit_1', u'weathersit_2', u'weathersit_3',\n",
       "       u'temp', u'atemp', u'hum', u'windspeed'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 591,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 划分训练集xy\n",
    "X_BS_train = BS_train_data.drop('cnt',axis = 1)\n",
    "X_BS_train.head()\n",
    "\n",
    "columns = X_BS_train.columns\n",
    "columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 582,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 继续划分训练集xy\n",
    "y_BS_train = BS_train_data['cnt'].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 583,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.348066</td>\n",
       "      <td>0.389564</td>\n",
       "      <td>0.653416</td>\n",
       "      <td>0.368479</td>\n",
       "      <td>2294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.219504</td>\n",
       "      <td>0.214212</td>\n",
       "      <td>0.189521</td>\n",
       "      <td>0.716652</td>\n",
       "      <td>1951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.056354</td>\n",
       "      <td>0.035004</td>\n",
       "      <td>0.278882</td>\n",
       "      <td>0.807826</td>\n",
       "      <td>2236</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.025139</td>\n",
       "      <td>0.239130</td>\n",
       "      <td>0.349571</td>\n",
       "      <td>2368</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.209944</td>\n",
       "      <td>0.251337</td>\n",
       "      <td>0.402485</td>\n",
       "      <td>0.211026</td>\n",
       "      <td>3272</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6  ...   workingday_0  workingday_1  weathersit_1  \\\n",
       "0       0       0  ...              1             0             1   \n",
       "1       0       0  ...              1             0             1   \n",
       "2       0       0  ...              0             1             1   \n",
       "3       0       0  ...              0             1             0   \n",
       "4       0       0  ...              0             1             1   \n",
       "\n",
       "   weathersit_2  weathersit_3      temp     atemp       hum  windspeed   cnt  \n",
       "0             0             0  0.348066  0.389564  0.653416   0.368479  2294  \n",
       "1             0             0  0.219504  0.214212  0.189521   0.716652  1951  \n",
       "2             0             0  0.056354  0.035004  0.278882   0.807826  2236  \n",
       "3             1             0  0.000000  0.025139  0.239130   0.349571  2368  \n",
       "4             0             0  0.209944  0.251337  0.402485   0.211026  3272  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 583,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 读取测试集\n",
    "BS_test_data = pd.read_csv(\"BS_test.csv\")\n",
    "BS_test_data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 584,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>workingday_1</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.348066</td>\n",
       "      <td>0.389564</td>\n",
       "      <td>0.653416</td>\n",
       "      <td>0.368479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.219504</td>\n",
       "      <td>0.214212</td>\n",
       "      <td>0.189521</td>\n",
       "      <td>0.716652</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.056354</td>\n",
       "      <td>0.035004</td>\n",
       "      <td>0.278882</td>\n",
       "      <td>0.807826</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.025139</td>\n",
       "      <td>0.239130</td>\n",
       "      <td>0.349571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.209944</td>\n",
       "      <td>0.251337</td>\n",
       "      <td>0.402485</td>\n",
       "      <td>0.211026</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 34 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6    ...      weekday_6  workingday_0  workingday_1  \\\n",
       "0       0       0    ...              0             1             0   \n",
       "1       0       0    ...              0             1             0   \n",
       "2       0       0    ...              0             0             1   \n",
       "3       0       0    ...              0             0             1   \n",
       "4       0       0    ...              0             0             1   \n",
       "\n",
       "   weathersit_1  weathersit_2  weathersit_3      temp     atemp       hum  \\\n",
       "0             1             0             0  0.348066  0.389564  0.653416   \n",
       "1             1             0             0  0.219504  0.214212  0.189521   \n",
       "2             1             0             0  0.056354  0.035004  0.278882   \n",
       "3             0             1             0  0.000000  0.025139  0.239130   \n",
       "4             1             0             0  0.209944  0.251337  0.402485   \n",
       "\n",
       "   windspeed  \n",
       "0   0.368479  \n",
       "1   0.716652  \n",
       "2   0.807826  \n",
       "3   0.349571  \n",
       "4   0.211026  \n",
       "\n",
       "[5 rows x 34 columns]"
      ]
     },
     "execution_count": 584,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 继续划分测试集xy\n",
    "X_BS_test = BS_test_data.drop('cnt',axis = 1)\n",
    "X_BS_test.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 586,
   "metadata": {},
   "outputs": [],
   "source": [
    " # 继续划分测试集xy\n",
    "y_BS_test = BS_test_data['cnt'].values  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 592,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2.520406e+14</td>\n",
       "      <td>holiday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2.447524e+14</td>\n",
       "      <td>holiday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>mnth_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>2.721000e+03</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>-2.710000e+02</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>-9.830312e+02</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>-1.252000e+03</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>-6.760312e+12</td>\n",
       "      <td>workingday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>weekday_5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>weekday_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>weekday_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>weekday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>weekday_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>-1.404854e+13</td>\n",
       "      <td>workingday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>-1.589178e+13</td>\n",
       "      <td>weekday_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>-1.589178e+13</td>\n",
       "      <td>weekday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>weathersit_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>weathersit_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>weathersit_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>season_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>season_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>season_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>season_1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            coef       columns\n",
       "16  2.520406e+14     holiday_0\n",
       "17  2.447524e+14     holiday_1\n",
       "8   1.710115e+14        mnth_5\n",
       "9   1.710115e+14        mnth_6\n",
       "12  1.710115e+14        mnth_9\n",
       "13  1.710115e+14       mnth_10\n",
       "7   1.710115e+14        mnth_4\n",
       "11  1.710115e+14        mnth_8\n",
       "14  1.710115e+14       mnth_11\n",
       "10  1.710115e+14        mnth_7\n",
       "15  1.710115e+14       mnth_12\n",
       "6   1.710115e+14        mnth_3\n",
       "5   1.710115e+14        mnth_2\n",
       "4   1.710115e+14        mnth_1\n",
       "30  2.721000e+03          temp\n",
       "31 -2.710000e+02         atemp\n",
       "33 -9.830312e+02     windspeed\n",
       "32 -1.252000e+03           hum\n",
       "25 -6.760312e+12  workingday_0\n",
       "23 -8.603552e+12     weekday_5\n",
       "20 -8.603552e+12     weekday_2\n",
       "21 -8.603552e+12     weekday_3\n",
       "19 -8.603552e+12     weekday_1\n",
       "22 -8.603552e+12     weekday_4\n",
       "26 -1.404854e+13  workingday_1\n",
       "24 -1.589178e+13     weekday_6\n",
       "18 -1.589178e+13     weekday_0\n",
       "27 -4.887024e+14  weathersit_1\n",
       "28 -4.887024e+14  weathersit_2\n",
       "29 -4.887024e+14  weathersit_3\n",
       "3  -5.229284e+16      season_4\n",
       "2  -5.229284e+16      season_3\n",
       "1  -5.229284e+16      season_2\n",
       "0  -5.229284e+16      season_1"
      ]
     },
     "execution_count": 592,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 线性回归\n",
    "#class sklearn.linear_model.LinearRegression(fit_intercept=True, normalize=False, copy_X=True, n_jobs=1)\n",
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "# 使用默认配置初始化\n",
    "lr = LinearRegression()\n",
    "\n",
    "# 训练模型参数\n",
    "lr.fit(X_BS_train, y_BS_train)\n",
    "\n",
    "# 预测\n",
    "y_test_pred_lr = lr.predict(X_BS_test)\n",
    "y_train_pred_lr = lr.predict(X_BS_train)\n",
    "\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef\":list((lr.coef_.T))})\n",
    "fs.sort_values(by=['coef'],ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 模型评价"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 593,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LinearRegression on test is -0.6489638976493455\n",
      "The r2 score of LinearRegression on train is 0.8402805791004272\n"
     ]
    }
   ],
   "source": [
    "# 使用r2_score评价模型在测试集和训练集上的性能，并输出评估结果\n",
    "#测试集\n",
    "print 'The r2 score of LinearRegression on test is', r2_score(y_BS_test, y_test_pred_lr)\n",
    "#训练集\n",
    "print 'The r2 score of LinearRegression on train is', r2_score(y_BS_train, y_train_pred_lr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 594,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAekAAAFsCAYAAADos0H8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHlhJREFUeJzt3Xuc3XV95/HXx2QglkBCwoSGRJqAoNyT7BCTxcVoENAgwcfaqouACxIXtQ/U1iq6ltFqWxeKLStqqchFUG5qYbVuwZQUYRWa0BiIgU0EWRPTZAC5BOWS5LN/nN+kJ8lM5szMmZlvcl7Px+M85pzv7/Y53zPJe76/24nMRJIklecVI12AJEnqmSEtSVKhDGlJkgplSEuSVChDWpKkQhnSkiQVypBWy4uIlRExb6TrGEkR8faI+GVEbIqImcO43U0RcUgv094bEfc0aTu/iIiTmrEuaTgZ0tqj9fSf847/+WfmUZm5pI/1TIuIjIjRQ1TqSLsU+FBmjs3Mf91xYvXen69CdV1EXBYRowa70Wp7jw52PdKeypCWClBA+P8esLKPeY7LzLHAG4B3AucOeVVSizOk1fLqR9sRMTsilkbEsxGxISIuq2a7u/r5dDWanBsRr4iI/x4Rj0fExoi4LiLG1a337GrakxHx6R220xkRt0bE9RHxLPDeats/joinI2J9RHwpIvaqW19GxAciYnVEPBcRfxYRh1bLPBsRN9fPv8N77LHWiNg7IjYBo4CfRsTP++qvzFwD3AvMqFv/uIi4qqp7XUR8rnukHRGvjoh/johnIuKJiLhph/f06ur5xIi4vXov9wOH1s23056MiFgSEe+rnh8aEf9U9fUTEXFDRIzvpS96+4yl4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fFV4DzgK02tTpI07LZs2cLixYs577zzALjjjjtYvXo1999/P5nJ6aefzt13301XVxcHHXQQ3//+9wF45plntlvP+vXrufjii1m2bBnjxo3jjW98IzNnztzltseMGcN3v/td9ttvP5544gnmzJnD6aefvt0JWN/85jc55ZRT+NSnPsWWLVv4zW9+M6D3+fDDD3PXXXfx3HPP8ZrXvIYLLriANWvWcNNNN3HvvffS1tbGBz7wAW644QbOPvtsPv/5zzNhwgS2bNnC/PnzWbFiBccee+y2uu+5554B1bErDY2kI2IqsAD4WvU6gDcB3X8GXQuc0fTqJEnD5re//S0zZsxg4sSJPPXUU7z5zW8GaiF9xx13MHPmTGbNmsXDDz/M6tWrOeaYY/jhD3/Ixz/+cX70ox8xbty47dZ33333MW/ePNrb29lrr7145zvf2WcNmcknP/lJjj32WE466STWrVvHhg0btpvn+OOP5+qrr6azs5MHH3yQfffdd0Dvd8GCBey9994ccMABTJo0iQ0bNrB48WKWLVvG8ccfz4wZM1i8eDGPPvooADfffDOzZs1i5syZrFy5kp/97Gfb1tXIexuIRnd3/zXwJ8DW6vVE4OnM3Fy9XgtMaXJtkqRh1H1M+vHHH+ell17adkw6M7noootYvnw5y5cvZ82aNZx33nkcfvjhLFu2jGOOOYaLLrqIz372szuts7dLkEaPHs3WrVu3rf+ll14C4IYbbqCrq4tly5axfPlyDjzwwJ2uMz7xxBO5++67mTJlCmeddRbXXXfdgN7v3nvvve35qFGj2Lx5M5nJOeecs+29PvLII3R2dvLYY49x6aWXsnjxYlasWMGCBQu2q2ufffYZUA196XN3d0ScBmzMzGURMa+7uYdZs5flFwGLAA4++OABlimpVP05C7nZZyxraIwbN47LL7+chQsXcsEFF3DKKafw6U9/mjPPPJOxY8eybt062tra2Lx5MxMmTOA973kPY8eO5ZprrtluPa973eu48MILefLJJ9lvv/245ZZbOO6444Dacdxly5bxB3/wB9x22228/PLLQG2X+aRJk2hra+Ouu+7i8cd3/kbHxx9/nClTpnD++efz/PPP88ADD3D22Wc35b3Pnz+fhQs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0x1110facd0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 5)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_BS_train - y_train_pred_lr,bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 595,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARgAAADQCAYAAADcQn7hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJztnX2UHGWZ6H/P9HSSSVAmkcjGETYBuSCsC8FcQHN3V6IGBIXIosCqi66KungF4USSK2cT3A+iqKD3ugoHdPH6QSJg5EMJCOGwyzFIYhJChEj4lIErgWQCJE0ymTz3j3pr0lNTVV3dXdVV3fP8zpnT3W+9XfW+011Pv+/zKaqKYRhGFnTlPQDDMDoXEzCGYWSGCRjDMDLDBIxhGJlhAsYwjMwwAWMYRmaYgDEMIzNMwBiGkRkmYAzDyIzuvAeQFwcccIBOnz4972EYRluyZs2aF1V1aq1+Y1bATJ8+ndWrV+c9DMNoS0Tk6ST9bItkGEZmmIAxDCMzxuwWyTCyZvnafq5YsYnnBiq8qbeH+ScdzryZfXkPq6WYgDEM0hcGy9f2s/DmDVQGhwDoH6iw8OYNAGNKyJiAMcY8WQiDK1ZsGj6fT2VwiCtWbKrrnEkFX1FXSyZgjDFPWsKgmucGKnW1hxEm+Ob/bD2X3bqRgZ2Dw4IEKOxqyQSMMeZJQxgEeVNvD/0h739Tb09o/7AVSJjgG9yrbNs5COwTJBPKXak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"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#还可以观察预测值与真值的散点图\n",
    "plt.figure(figsize=(4, 3))\n",
    "plt.scatter(y_BS_train, y_train_pred_lr)\n",
    "plt.plot([-3, 3], [-3, 3], '--k')   #数据已经标准化，3倍标准差即可\n",
    "plt.axis('tight')\n",
    "plt.xlabel('True price')\n",
    "plt.ylabel('Predicted price')\n",
    "plt.tight_layout()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 596,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-433.78458158,   60.21822693,  455.09246856,  734.21002899,\n",
       "       -617.83866757, -450.87445072, -291.73195442,  154.42510944,\n",
       "        903.45084187,  680.16202065,  -71.63551427,   46.23903417,\n",
       "        463.44167945,  289.74358821, -123.78895912, -165.8565848 ,\n",
       "        590.53279601,  225.20334689,   13.91388963,  109.7713242 ,\n",
       "        155.92106305,  108.97585724,   96.72553507,  166.34561825,\n",
       "        164.08285545,  403.20009198,  412.53605093,  968.13771979,\n",
       "        617.70699971, -770.1085766 , 1309.02166971, 1155.22362327,\n",
       "       -920.07668921, -781.34371169])"
      ]
     },
     "execution_count": 596,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 线性模型，随机梯度下降优化模型参数\n",
    "# 随机梯度下降一般在大数据集上应用，其实本项目不适合用\n",
    "from sklearn.linear_model import SGDRegressor\n",
    "\n",
    "# 使用默认配置初始化线\n",
    "sgdr = SGDRegressor(max_iter=1000)\n",
    "\n",
    "# 训练：参数估计\n",
    "sgdr.fit(X_BS_train, y_BS_train)\n",
    "\n",
    "# 预测\n",
    "#sgdr_y_predict = sgdr.predict(X_test)\n",
    "\n",
    "sgdr.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 597,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of default measurement of SGDRegressor on test is -0.6104728861346513\n",
      "The value of default measurement of SGDRegressor on train is 0.8396859012222379\n"
     ]
    }
   ],
   "source": [
    "# 使用SGDRegressor模型自带的评估模块(评价准则为r2_score)，并输出评估结果\n",
    "print 'The value of default measurement of SGDRegressor on test is', sgdr.score(X_BS_test, y_BS_test)\n",
    "print 'The value of default measurement of SGDRegressor on train is', sgdr.score(X_BS_train, y_BS_train)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.2 正则化的线性回归（L2正则 --> 岭回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 598,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of RidgeCV on test is -0.6122608739529756\n",
      "The r2 score of RidgeCV on train is 0.8394533818778019\n"
     ]
    }
   ],
   "source": [
    "#岭回归／L2正则\n",
    "#class sklearn.linear_model.RidgeCV(alphas=(0.1, 1.0, 10.0), fit_intercept=True, \n",
    "#                                  normalize=False, scoring=None, cv=None, gcv_mode=None, \n",
    "#                                  store_cv_values=False)\n",
    "from sklearn.linear_model import  RidgeCV\n",
    "\n",
    "#设置超参数（正则参数）范围\n",
    "alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "#n_alphas = 20\n",
    "#alphas = np.logspace(-5,2,n_alphas)\n",
    "\n",
    "#生成一个RidgeCV实例\n",
    "ridge = RidgeCV(alphas=alphas, store_cv_values=True)  \n",
    "\n",
    "#模型训练\n",
    "ridge.fit(X_BS_train, y_BS_train)    \n",
    "\n",
    "#预测\n",
    "y_test_pred_ridge = ridge.predict(X_BS_test)\n",
    "y_train_pred_ridge = ridge.predict(X_BS_train)\n",
    "\n",
    "\n",
    "# 评估，使用r2_score评价模型在测试集和训练集上的性能\n",
    "print 'The r2 score of RidgeCV on test is', r2_score(y_BS_test, y_test_pred_ridge)\n",
    "print 'The r2 score of RidgeCV on train is', r2_score(y_BS_train, y_train_pred_ridge)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 599,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZsAAAEKCAYAAADEovgeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl4XNWZ5/Hvq80bXmRbNsaLZMBAIARjCy+QzgIJGHcGQwLBhGCFYcadTJgnPfNMd+DpmaEn6Z5JuqebaWYSZuhAI7PEOE4ITtrEcUyW7ra8SMZgGwMWRrLkVbbkHVvbO3/cI1NWSqt1q0rS7/M89dSt955771uF0at76ugcc3dERETilJXuBEREZOBTsRERkdip2IiISOxUbEREJHYqNiIiEjsVGxERiZ2KjYiIxE7FRkREYqdiIyIisctJdwKZYvz48V5UVJTuNERE+pWKiorD7l7QVTsVm6CoqIjy8vJ0pyEi0q+YWXV32sXWjWZmV5rZ1oTHcTP7YzP7czPbmxBfmHDMo2ZWaWbvmNltCfEFIVZpZo8kxKeb2UYz22VmL5lZXogPCa8rw/6iuN6niIh0LbZi4+7vuPtMd58JzAZOAy+H3Y+37XP31QBmdjWwGLgGWAB838yyzSwb+B5wO3A1cF9oC/DdcK4ZQAPwUIg/BDS4++XA46GdiIikSaoGCNwCvOfund1uLQKWu/tZd38fqATmhEelu+9290ZgObDIzAy4GVgZji8F7kw4V2nYXgncEtqLiEgapKrYLAZ+mPD6YTN708yeMbP8EJsM1CS0qQ2xjuLjgKPu3twuft65wv5job2IiKRB7MUmfI9yB/CjEHoSuAyYCewH/qataZLDvRfxzs7VPrelZlZuZuV1dXUdvgcREbkwqbizuR3Y4u4HAdz9oLu3uHsr8PdE3WQQ3ZlMTThuCrCvk/hhYIyZ5bSLn3eusH80UN8+MXd/yt2L3b24oKDLkXsiItJLqSg295HQhWZmkxL23QVsD9urg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cUL8EPDZ0P5e4ImE9uXAH/T8rYr0jCbiFOk7Hyea/bgFOGhmvwVuCPEfuXsrcMDMfp1wzCSgLuH1F8OyDzlh39VEU4wkagVeCtvPA4mTKrZtVxAVOIBc4P+Y2UygBbgiof0hommDRGKlYiPSdzpayKyzBc4+IJrzDDObDvwn4AZ3bzCzZ9v2dSFxzqmz4bmFD////g9Ec9JdR9SbcSah/dCQg0is1I0m0nd+B9xrZtnhe5RPEE2Y+c9Ei4tlmdlEomWB2+wELg/bo4BTwLHQ7vYOrpNFNOszwJfC+TszGtgf7qweIFrquc0VZMas3zLA6c5GpO+8TPR9zBtEdxt/6u4HzOzHwC1EP9TfJVoh8Vg45h+Jis+v3P0NM3udaEbg3cC/dHCdU8A1ZlYRznNvF3l9H/ixmd1DNCvzqYR9nw45iMRKsz6LpICZXeTRyozjiO52bgqFaBhRAbgpfNfTnXOddPeL+iiv3wGL3L2hL84n0hHd2Yikxs/NbAyQB3zb3Q8AuPsHZvYY0Vrve1KZUOjq+1sVGkkF3dmIiEjsNEBARERip2IjIiKxU7EREZHYqdiIiEjsVGxERCR2KjYiIhK7/w/vReWhH6fZXwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10c20d310>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('alpha is:', 1.0)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2.520406e+14</td>\n",
       "      <td>124.747605</td>\n",
       "      <td>holiday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2.447524e+14</td>\n",
       "      <td>-124.747605</td>\n",
       "      <td>holiday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>811.914842</td>\n",
       "      <td>mnth_5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>614.788377</td>\n",
       "      <td>mnth_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>403.156466</td>\n",
       "      <td>mnth_9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>231.340072</td>\n",
       "      <td>mnth_10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>58.387976</td>\n",
       "      <td>mnth_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>14.378910</td>\n",
       "      <td>mnth_8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-185.371804</td>\n",
       "      <td>mnth_11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-90.222422</td>\n",
       "      <td>mnth_7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-240.673590</td>\n",
       "      <td>mnth_12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-384.007317</td>\n",
       "      <td>mnth_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-523.838431</td>\n",
       "      <td>mnth_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-709.853079</td>\n",
       "      <td>mnth_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>2.721000e+03</td>\n",
       "      <td>1243.064973</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>-2.710000e+02</td>\n",
       "      <td>1039.421825</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>-9.830312e+02</td>\n",
       "      <td>-788.845377</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>-1.252000e+03</td>\n",
       "      <td>-965.287772</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>-6.760312e+12</td>\n",
       "      <td>-49.957255</td>\n",
       "      <td>workingday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>23.229714</td>\n",
       "      <td>weekday_5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>15.310689</td>\n",
       "      <td>weekday_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>-35.842258</td>\n",
       "      <td>weekday_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>-30.152886</td>\n",
       "      <td>weekday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>-47.335610</td>\n",
       "      <td>weekday_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>-1.404854e+13</td>\n",
       "      <td>49.957255</td>\n",
       "      <td>workingday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>-1.589178e+13</td>\n",
       "      <td>107.163957</td>\n",
       "      <td>weekday_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>-1.589178e+13</td>\n",
       "      <td>-32.373607</td>\n",
       "      <td>weekday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>658.864767</td>\n",
       "      <td>weathersit_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>318.507436</td>\n",
       "      <td>weathersit_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>-977.372203</td>\n",
       "      <td>weathersit_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>506.116161</td>\n",
       "      <td>season_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>266.716714</td>\n",
       "      <td>season_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>-111.464695</td>\n",
       "      <td>season_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>-661.368180</td>\n",
       "      <td>season_1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         coef_lr   coef_ridge       columns\n",
       "16  2.520406e+14   124.747605     holiday_0\n",
       "17  2.447524e+14  -124.747605     holiday_1\n",
       "8   1.710115e+14   811.914842        mnth_5\n",
       "9   1.710115e+14   614.788377        mnth_6\n",
       "12  1.710115e+14   403.156466        mnth_9\n",
       "13  1.710115e+14   231.340072       mnth_10\n",
       "7   1.710115e+14    58.387976        mnth_4\n",
       "11  1.710115e+14    14.378910        mnth_8\n",
       "14  1.710115e+14  -185.371804       mnth_11\n",
       "10  1.710115e+14   -90.222422        mnth_7\n",
       "15  1.710115e+14  -240.673590       mnth_12\n",
       "6   1.710115e+14  -384.007317        mnth_3\n",
       "5   1.710115e+14  -523.838431        mnth_2\n",
       "4   1.710115e+14  -709.853079        mnth_1\n",
       "30  2.721000e+03  1243.064973          temp\n",
       "31 -2.710000e+02  1039.421825         atemp\n",
       "33 -9.830312e+02  -788.845377     windspeed\n",
       "32 -1.252000e+03  -965.287772           hum\n",
       "25 -6.760312e+12   -49.957255  workingday_0\n",
       "23 -8.603552e+12    23.229714     weekday_5\n",
       "20 -8.603552e+12    15.310689     weekday_2\n",
       "21 -8.603552e+12   -35.842258     weekday_3\n",
       "19 -8.603552e+12   -30.152886     weekday_1\n",
       "22 -8.603552e+12   -47.335610     weekday_4\n",
       "26 -1.404854e+13    49.957255  workingday_1\n",
       "24 -1.589178e+13   107.163957     weekday_6\n",
       "18 -1.589178e+13   -32.373607     weekday_0\n",
       "27 -4.887024e+14   658.864767  weathersit_1\n",
       "28 -4.887024e+14   318.507436  weathersit_2\n",
       "29 -4.887024e+14  -977.372203  weathersit_3\n",
       "3  -5.229284e+16   506.116161      season_4\n",
       "2  -5.229284e+16   266.716714      season_3\n",
       "1  -5.229284e+16  -111.464695      season_2\n",
       "0  -5.229284e+16  -661.368180      season_1"
      ]
     },
     "execution_count": 599,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mse_mean = np.mean(ridge.cv_values_, axis = 0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1)) \n",
    "\n",
    "#这是为了标出最佳参数的位置，不是必须\n",
    "#plt.plot(np.log10(ridge.alpha_)*np.ones(3), [0.28, 0.29, 0.30])\n",
    "\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', ridge.alpha_)\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.3 正则化的线性回归（L1正则 --> Lasso）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 601,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LassoCV on test is -0.6453332297324057\n",
      "The r2 score of LassoCV on train is 0.840543570110819\n"
     ]
    }
   ],
   "source": [
    "#### Lasso／L1正则\n",
    "# class sklearn.linear_model.LassoCV(eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, \n",
    "#                                    normalize=False, precompute=’auto’, max_iter=1000, \n",
    "#                                    tol=0.0001, copy_X=True, cv=None, verbose=False, n_jobs=1,\n",
    "#                                    positive=False, random_state=None, selection=’cyclic’)\n",
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "#设置超参数搜索范围\n",
    "#alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "\n",
    "#生成一个LassoCV实例\n",
    "#lasso = LassoCV(alphas=alphas)  \n",
    "lasso = LassoCV()  \n",
    "\n",
    "#训练（内含CV）\n",
    "lasso.fit(X_BS_train, y_BS_train)  \n",
    "\n",
    "#测试\n",
    "y_test_pred_lasso = lasso.predict(X_BS_test)\n",
    "y_train_pred_lasso = lasso.predict(X_BS_train)\n",
    "\n",
    "\n",
    "# 评估，使用r2_score评价模型在测试集和训练集上的性能\n",
    "print 'The r2 score of LassoCV on test is', r2_score(y_BS_test, y_test_pred_lasso)\n",
    "print 'The r2 score of LassoCV on train is', r2_score(y_BS_train, y_train_pred_lasso)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 602,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaEAAAEKCAYAAAC7c+rvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl8XHW9//HXJ2vTJUmbpvu+UNpCW0qgZVEQUCqiBWWpIhQEES+4Xf1dUO8Fr3oVN9xBwCKLCFRAKcoiIFhBWkj3hpY2TbekS9Jma9I06+f3x5xiKEkzbTM5M8n7+XjMI2e+53vO+Rwm6Ztz5jvfMXdHREQkDElhFyAiIj2XQkhEREKjEBIRkdAohEREJDQKIRERCY1CSEREQqMQEhGR0CiEREQkNAohEREJTUrYBcS7gQMH+pgxY8IuQ0QkoSxbtmyPu+d21E8h1IExY8aQn58fdhkiIgnFzLZG00+340REJDQKIRERCY1CSEREQqMQEhGR0CiEREQkNAohEREJjUJIRERCoxASEZH3+NmLG1i+rSLmx9GHVUVE5F3e3FLOz17cCMDMUf1jeixdCYmIyDtaWpxvP/0WQ7N68bn3j4/58RRCIiLyjidXlLCmpIqb5xxPRlpyzI+nEBIREQBq65v44XPrmTEym49NH9Ylx1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ZjE4KMXdTwW+3Kq9FPhg0P9y4Bet+ucD7zvyUxU5Mpq2RyT2ziQyy3czkYlx/wGcErT/0d1bgF1m9nKrbYYCZa2eX2Zm1xP5mx0KTAFWH3KcFuCxYPn3QOsJLA8uLyMSfBCZZudXZjYDaAaOa9W/FBh2hOcpcsQUQiKx196XBR7uSwTrgF4AZjYW+BpwirtXmNn9B9d1oPWcXAdnGW/m33/3XwF2E7lCSwIOtOrfK6hBJKZ0O04k9hYDl5tZcvA+zfuBN4BXiXwZX5KZDSYyIehB64AJwXImUAtUBf0+3M5xkohMUAnwqWD/h5MF7AyuxK4kMkHsQccBa6M4N5Fjoishkdj7E5H3e1YRuTr5L3ffZWZPAOcS+cd+A5FvwawKtvkrkVB60d1XmdkKoAAoAl5r5zi1wFQzWxbs5/IO6roTeMLMLgVeDrY/6ANBDSIxpVm0RUJkZn2Db7nMIXJ1dEYQUBlEguGM4L2kaPZV4+59O6muxcBcd6/ojP2JtEdXQiLh+ouZZQNpwHfcfReAu9eZ2W3AcCLfZ9VlgluGdyiApCvoSkhEREKjgQkiIhIahZCIiIRGISQiIqFRCImISGgUQiIiEhqFkIiIhOb/AywA8lmT2h0CAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a176b3890>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('alpha is:', 0.803526526412423)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef_lasso</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>3.606228e+02</td>\n",
       "      <td>2.520406e+14</td>\n",
       "      <td>124.747605</td>\n",
       "      <td>holiday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>-1.390982e-12</td>\n",
       "      <td>2.447524e+14</td>\n",
       "      <td>-124.747605</td>\n",
       "      <td>holiday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>8.924622e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>811.914842</td>\n",
       "      <td>mnth_5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6.143420e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>614.788377</td>\n",
       "      <td>mnth_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>4.373262e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>403.156466</td>\n",
       "      <td>mnth_9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>3.256523e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>231.340072</td>\n",
       "      <td>mnth_10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1.569623e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>58.387976</td>\n",
       "      <td>mnth_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>14.378910</td>\n",
       "      <td>mnth_8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>-6.119369e+01</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-185.371804</td>\n",
       "      <td>mnth_11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>-1.061846e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-90.222422</td>\n",
       "      <td>mnth_7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>-1.091295e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-240.673590</td>\n",
       "      <td>mnth_12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-2.780647e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-384.007317</td>\n",
       "      <td>mnth_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>-4.108057e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-523.838431</td>\n",
       "      <td>mnth_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-5.861531e+02</td>\n",
       "      <td>1.710115e+14</td>\n",
       "      <td>-709.853079</td>\n",
       "      <td>mnth_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>2.486132e+03</td>\n",
       "      <td>2.721000e+03</td>\n",
       "      <td>1243.064973</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>-2.710000e+02</td>\n",
       "      <td>1039.421825</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>-9.258399e+02</td>\n",
       "      <td>-9.830312e+02</td>\n",
       "      <td>-788.845377</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>-1.169665e+03</td>\n",
       "      <td>-1.252000e+03</td>\n",
       "      <td>-965.287772</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>-0.000000e+00</td>\n",
       "      <td>-6.760312e+12</td>\n",
       "      <td>-49.957255</td>\n",
       "      <td>workingday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>4.660877e+01</td>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>23.229714</td>\n",
       "      <td>weekday_5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>3.784190e+01</td>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>15.310689</td>\n",
       "      <td>weekday_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>-0.000000e+00</td>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>-35.842258</td>\n",
       "      <td>weekday_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>-0.000000e+00</td>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>-30.152886</td>\n",
       "      <td>weekday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>-1.676680e+01</td>\n",
       "      <td>-8.603552e+12</td>\n",
       "      <td>-47.335610</td>\n",
       "      <td>weekday_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>-1.404854e+13</td>\n",
       "      <td>49.957255</td>\n",
       "      <td>workingday_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>3.952565e+01</td>\n",
       "      <td>-1.589178e+13</td>\n",
       "      <td>107.163957</td>\n",
       "      <td>weekday_6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>-9.221480e+01</td>\n",
       "      <td>-1.589178e+13</td>\n",
       "      <td>-32.373607</td>\n",
       "      <td>weekday_0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>3.033722e+02</td>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>658.864767</td>\n",
       "      <td>weathersit_1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>318.507436</td>\n",
       "      <td>weathersit_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>-1.324196e+03</td>\n",
       "      <td>-4.887024e+14</td>\n",
       "      <td>-977.372203</td>\n",
       "      <td>weathersit_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2.820539e+02</td>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>506.116161</td>\n",
       "      <td>season_4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.354420e+01</td>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>266.716714</td>\n",
       "      <td>season_3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-3.444990e+02</td>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>-111.464695</td>\n",
       "      <td>season_2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-8.680846e+02</td>\n",
       "      <td>-5.229284e+16</td>\n",
       "      <td>-661.368180</td>\n",
       "      <td>season_1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      coef_lasso       coef_lr   coef_ridge       columns\n",
       "16  3.606228e+02  2.520406e+14   124.747605     holiday_0\n",
       "17 -1.390982e-12  2.447524e+14  -124.747605     holiday_1\n",
       "8   8.924622e+02  1.710115e+14   811.914842        mnth_5\n",
       "9   6.143420e+02  1.710115e+14   614.788377        mnth_6\n",
       "12  4.373262e+02  1.710115e+14   403.156466        mnth_9\n",
       "13  3.256523e+02  1.710115e+14   231.340072       mnth_10\n",
       "7   1.569623e+02  1.710115e+14    58.387976        mnth_4\n",
       "11  0.000000e+00  1.710115e+14    14.378910        mnth_8\n",
       "14 -6.119369e+01  1.710115e+14  -185.371804       mnth_11\n",
       "10 -1.061846e+02  1.710115e+14   -90.222422        mnth_7\n",
       "15 -1.091295e+02  1.710115e+14  -240.673590       mnth_12\n",
       "6  -2.780647e+02  1.710115e+14  -384.007317        mnth_3\n",
       "5  -4.108057e+02  1.710115e+14  -523.838431        mnth_2\n",
       "4  -5.861531e+02  1.710115e+14  -709.853079        mnth_1\n",
       "30  2.486132e+03  2.721000e+03  1243.064973          temp\n",
       "31  0.000000e+00 -2.710000e+02  1039.421825         atemp\n",
       "33 -9.258399e+02 -9.830312e+02  -788.845377     windspeed\n",
       "32 -1.169665e+03 -1.252000e+03  -965.287772           hum\n",
       "25 -0.000000e+00 -6.760312e+12   -49.957255  workingday_0\n",
       "23  4.660877e+01 -8.603552e+12    23.229714     weekday_5\n",
       "20  3.784190e+01 -8.603552e+12    15.310689     weekday_2\n",
       "21 -0.000000e+00 -8.603552e+12   -35.842258     weekday_3\n",
       "19 -0.000000e+00 -8.603552e+12   -30.152886     weekday_1\n",
       "22 -1.676680e+01 -8.603552e+12   -47.335610     weekday_4\n",
       "26  0.000000e+00 -1.404854e+13    49.957255  workingday_1\n",
       "24  3.952565e+01 -1.589178e+13   107.163957     weekday_6\n",
       "18 -9.221480e+01 -1.589178e+13   -32.373607     weekday_0\n",
       "27  3.033722e+02 -4.887024e+14   658.864767  weathersit_1\n",
       "28  0.000000e+00 -4.887024e+14   318.507436  weathersit_2\n",
       "29 -1.324196e+03 -4.887024e+14  -977.372203  weathersit_3\n",
       "3   2.820539e+02 -5.229284e+16   506.116161      season_4\n",
       "2   3.354420e+01 -5.229284e+16   266.716714      season_3\n",
       "1  -3.444990e+02 -5.229284e+16  -111.464695      season_2\n",
       "0  -8.680846e+02 -5.229284e+16  -661.368180      season_1"
      ]
     },
     "execution_count": 602,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mses = np.mean(lasso.mse_path_, axis = 1)\n",
    "plt.plot(np.log10(lasso.alphas_), mses) \n",
    "#plt.plot(np.log10(lasso.alphas_)*np.ones(3), [0.3, 0.4, 1.0])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()    \n",
    "            \n",
    "print ('alpha is:', lasso.alpha_)\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T)), \"coef_lasso\":list((lasso.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 603,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaEAAAEKCAYAAAC7c+rvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl8XHW9//HXJ2vTJUmbpvu+UNpCW0qgZVEQUCqiBWWpIhQEES+4Xf1dUO8Fr3oVN9xBwCKLCFRAKcoiIFhBWkj3hpY2TbekS9Jma9I06+f3x5xiKEkzbTM5M8n7+XjMI2e+53vO+Rwm6Ztz5jvfMXdHREQkDElhFyAiIj2XQkhEREKjEBIRkdAohEREJDQKIRERCY1CSEREQqMQEhGR0CiEREQkNAohEREJTUrYBcS7gQMH+pgxY8IuQ0QkoSxbtmyPu+d21E8h1IExY8aQn58fdhkiIgnFzLZG00+340REJDQKIRERCY1CSEREQqMQEhGR0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0uCza6g1SwdZnZXMFFugZn9bzvHqTGzn5jZcjN7ycxyW62+1MzeMLMNZva+oP8YM/tn0H+5mZ3eqv+fgxpEYkohJBJ7HwdmANOB84AfBVMNfRwYA5wIXAec1mqbM4BlrZ5/093zgGnAWWY2rY3j9AGWu/tM4B9EZjE4KMXdTwW+3Kq9FPhg0P9y4Bet+ucD7zvyUxU5Mpq2RyT2ziQyy3czkYlx/wGcErT/0d1bgF1m9nKrbYYCZa2eX2Zm1xP5mx0KTAFWH3KcFuCxYPn3QOsJLA8uLyMSfBCZZudXZjYDaAaOa9W/FBh2hOcpcsQUQiKx196XBR7uSwTrgF4AZjYW+BpwirtXmNn9B9d1oPWcXAdnGW/m33/3XwF2E7lCSwIOtOrfK6hBJKZ0O04k9hYDl5tZcvA+zfuBN4BXiXwZX5KZDSYyIehB64AJwXImUAtUBf0+3M5xkohMUAnwqWD/h5MF7AyuxK4kMkHsQccBa6M4N5Fjoishkdj7E5H3e1YRuTr5L3ffZWZPAOcS+cd+A5FvwawKtvkrkVB60d1XmdkKoAAoAl5r5zi1wFQzWxbs5/IO6roTeMLMLgVeDrY/6ANBDSIxpVm0RUJkZn2Db7nMIXJ1dEYQUBlEguGM4L2kaPZV4+59O6muxcBcd6/ojP2JtEdXQiLh+ouZZQNpwHfcfReAu9eZ2W3AcCLfZ9VlgluGdyiApCvoSkhEREKjgQkiIhIahZCIiIRGISQiIqFRCImISGgUQiIiEhqFkIiIhOb/AywA8lmT2h0CAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10c2361d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('alpha is:', 0.803526526412423)\n"
     ]
    }
   ],
   "source": [
    "mses = np.mean(lasso.mse_path_, axis = 1)\n",
    "plt.plot(np.log10(lasso.alphas_), mses) \n",
    "#plt.plot(np.log10(lasso.alphas_)*np.ones(3), [0.3, 0.4, 1.0])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()    \n",
    "            \n",
    "print ('alpha is:', lasso.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
